<?php
	$current = 56;
	require_once 'includes/global.inc.php';
	$success = false;
	$message = NULL;
	$List = new ListTools();
	
	$i_itemcode = "";
	$i_regdate = "";
	$i_remark = "";
	$i_itemtype = "";
	
	if(isset($_POST['submit-form'])) {
		$i_itemcode = $_POST['itemcode'];
		$i_regdate = strtotime("now");
		$i_remark = $_POST['remark'];
		$i_itemcolor = $_POST['color'];
		$i_itemtype = $_POST['type'];
		$success = true;
	}
	//initialize variables for form validation
	
	
	if($success)
	{
	    //prep the data for saving in a new user object
	    $data['i_itemcode'] = $i_itemcode;
		$data['i_itemtype'] = $i_itemtype;
		$data['i_itemcolor'] = $i_itemcolor;
		$data['i_remark'] = $i_remark;
		$data['i_regdate'] = $i_regdate;

	    //create the new user object
	    $newItem = new Item($data);

	    //save the new user to the database
	    $newItem->save(true);
		
//		header('Location: expenses.php?page=issue&msg=1');
		
	    //redirect them to a welcome page
	    $message = "<!-- Notification -->
		<div class=\"notification success\">
			<a href=\"#\" class=\"close-notification\" title=\"Hide Notification\" rel=\"tooltip\">x</a>
			<p><strong>New Item Add Success</strong></p>
		</div>
		<!-- /Notification -->";
	}
?>
<!doctype html>
<!--[if IE 7 ]>    <html lang="en" class="no-js ie7"> <![endif]-->
<!--[if IE 8 ]>    <html lang="en" class="no-js ie8"> <![endif]-->
<!--[if IE 9 ]>    <html lang="en" class="no-js ie9"> <![endif]-->
<!--[if (gt IE 9)|!(IE)]><!--> <html lang="en" class="no-js"> <!--<![endif]-->
<head>
	<title>New item - Laundry Box</title>
	<meta charset="UTF-8">
	<meta name="description" content="">
	<meta name="author" content="">
	<meta name="viewport" content="width=device-width, initial-scale=1.0">
	
	<link rel="shortcut icon" href="http://envato.parallaq.com/favicon.ico">
	 
	
	<!-- CSS Styles -->
	<link rel="stylesheet" href="css/style.css">
	<link rel="stylesheet" href="css/colors.css">
	<link rel="stylesheet" href="css/jquery.tipsy.css">
	<link rel="stylesheet" href="css/jquery.wysiwyg.css">
	<link rel="stylesheet" href="css/jquery.datatables.css">
	<link rel="stylesheet" href="css/jquery.nyromodal.css">
	<link rel="stylesheet" href="css/jquery.datepicker.css">
	<link rel="stylesheet" href="css/jquery.fileinput.css">
	<link rel="stylesheet" href="css/jquery.fullcalendar.css">
	<link rel="stylesheet" href="css/jquery.visualize.css">

	<!-- Google WebFonts -->
	<link href='http://fonts.googleapis.com/css?family=PT+Sans:regular,italic,bold,bolditalic' rel='stylesheet' type='text/css'>

	<script src="js/libs/modernizr-1.7.min.js"></script>
</head>

<!-- Add class .fixed for fixed layout. You would need also edit CSS file for width -->
<body>

	<!-- Fixed Layout Wrapper -->
	<div class="fixed-wraper">

	<?php 
		include('module/leftside.php');
	?>
	
	<!-- Main Content -->
	<section role="main">
	
		
		<!-- Breadcumbs -->
		<ul id="breadcrumbs">
			<li><a href="#" title="Back to Homepage">Back to Home</a></li>
			<li><a href="#">Admin Panel</a></li>
			<li><a href="#">Item</a></li>
			<li><a href="#">New Item</a></li>
			<li>Current Page</li>
		</ul>
		<!-- /Breadcumbs -->
		
		<!-- Full Content Block -->
		<!-- Note that only 1st article need clearfix class for clearing -->
		<article class="full-block clearfix">
		
			<!-- Article Container for safe floating -->
			<div class="article-container">
			
				<!-- Article Header -->
				<header>
					<h2>Laundry Box Admin Panel</h2>
					<!-- Article Header Tab Navigation -->
					
					<!-- /Article Header Tab Navigation -->
				</header>
				<!-- /Article Header -->
				<?php echo ($message != "") ? $message : ""; ?>
				<!-- Article Content -->
				<section>
				
					<!-- Tab Content #tab0 -->
					<div class="tab default-tab" id="tab0">
						<h3>New Item</h3>
						<form action="item-add.php" method="post">
								<!-- Inputs -->
								<!-- Use class .small, .medium or .large for predefined size -->
								<fieldset>
									<legend>Item Registration Form</legend>
									<dl>
										<dt>
											<label>Customer ID</label>
										</dt>
										<dd>
											<input type="text" class="" value="" name="itemcode">
										</dd>
										<dt>
											<label>Name</label>
										</dt>
										<dd>
											<input type="text" class="" value="" name="itemcode">
										</dd>
										<dt>
											<label>NRIC</label>
										</dt>
										<dd>
											<input type="text" class="" value="" name="itemcode">
										</dd>
										<dt>
											<label>Contact 1</label>
										</dt>
										<dd>
											<input type="text" class="" value="" name="itemcode">
										</dd>
										<dt>
											<label>Contact 2</label>
										</dt>
										<dd>
											<input type="text" class="" value="" name="itemcode">
										</dd>
										<dt>
											<label>Email</label>
										</dt>
										<dd>
											<input type="text" class="" value="" name="itemcode">
										</dd>
										<dt>
											<label>Gender</label>
										</dt>

										<dd>
											<input type="radio" name="sex" value="male" /> Male &nbsp;&nbsp;
											<input type="radio" name="sex" value="female" /> Female
										</dd>
										<dt>
											<label>Remarks</label>
										</dt>
										<dd>
											<!-- Use class .wysiwyg for jQuery jWYSIWYG initiation -->
											<textarea rows="5" cols="40" class="wysiwyg large" name="remark"> </textarea>
											<p>Short description of event</p>
										</dd>
									</dl>
								</fieldset>
								<input type="text" hidden="hidden" name="submit-form" value="Create"/>
								<button type="submit">Submit</button> or <a href="#">Cancel</a>
							</form>

					</div>
					<!-- /Tab Content #tab0 -->
				
					
				</section>
				<!-- /Article Content -->
				
				<!-- Article Footer -->
				
				<!-- /Article Footer -->
			
			</div>
			<!-- /Article Container -->
			
		</article>
		<!-- /Full Content Block -->
		
		<!-- Full Content Block with .nested style -->
		<article class="full-block nested">
		
			
		
		</article>
		<!-- /Full Content Block with .nested style -->
		
		<div class="clearfix"></div> <!-- We're really sorry for this, but because of IE7 we still need separated div with clearfix -->
		
	
	</section>
	<!-- /Main Content -->
	
	</div>
	<!-- /Fixed Layout Wrapper -->

	<!-- JS Libs at the end for faster loading -->
	<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.5.1/jquery.min.js"></script>
	<script>!window.jQuery && document.write(unescape('%3Cscript src="js/jquery/jquery-1.5.1.min.js"%3E%3C/script%3E'))</script>
	<script src="js/libs/selectivizr.js"></script>
	<script src="js/jquery/jquery.nyromodal.js"></script>
	<script src="js/jquery/jquery.tipsy.js"></script>
	<script src="js/jquery/jquery.wysiwyg.js"></script>
	<script src="js/jquery/jquery.datatables.js"></script>
	<script src="js/jquery/jquery.datepicker.js"></script>
	<script src="js/jquery/jquery.fileinput.js"></script>
	<script src="js/jquery/jquery.fullcalendar.min.js"></script>
	<script src="js/jquery/excanvas.js"></script>
	<script src="js/jquery/jquery.visualize.js"></script>
	<script src="js/jquery/jquery.visualize.tooltip.js"></script>
	<script src="js/script.js"></script>
</body>
</html>